﻿using Admin.Models;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace Admin.DAL
{
    public class Floor2AdminDAL:ConnectionDB
    {
        public List<FloorAdminModel> Floor2(string id)
        {
            List<FloorAdminModel> list = new List<FloorAdminModel>();
            SqlCommand command = CreateCommand("select * from T2");

            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                FloorAdminModel pro = new FloorAdminModel();

                
                pro.ID = dr["ID"].ToString();
                pro.NAME = dr["NAME"].ToString();

                list.Add(pro);
            }
            Connection.Close();
            return list;
        }
        public List<FloorAdminModel> deleteF2(string id)
        {
            List<FloorAdminModel> list = new List<FloorAdminModel>();
            SqlCommand command = CreateCommand("select * from T2 where ID='" + id + "'");
            SqlDataReader dr = command.ExecuteReader();
            while (dr.Read() == true)
            {
                FloorAdminModel pr = new FloorAdminModel();

                pr.ID = dr["ID"].ToString();
                pr.NAME = dr["NAME"].ToString();
                
                list.Add(pr);
            }
            Connection.Close();
            return list;
        }
        public List<FloorAdminModel> editF2(string id)
        {
            List<FloorAdminModel> list = new List<FloorAdminModel>();
            SqlCommand command = CreateCommand("select * from T2 where ID='" + id + "'");
            SqlDataReader dr = command.ExecuteReader();
            while (dr.Read() == true)
            {
                FloorAdminModel pr = new FloorAdminModel();

                pr.ID = dr["ID"].ToString();
                pr.NAME = dr["NAME"].ToString();
                
                list.Add(pr);
            }
            Connection.Close();
            return list;
        }
    }
}